<?php
/**
 * Created by PhpStorm.
 * User: Daxu
 * Date: 2018/3/25
 * Time: 20:01
 */

namespace App\Http\Controllers\API;


use App\Http\Controllers\Controller;
use App\Http\Resources\DataListResource;
use App\Http\Resources\LawsResource;
use App\Http\Resources\MediatorListResource;
use App\Http\Resources\PermissionListResource;
use App\Model\Laws;
use App\Model\MediationOrganizationInfos;
use App\Model\MediatorInfo;
use App\Model\Permission;

class DataProviderController extends Controller
{
    public function organizationList(){
        $models = MediationOrganizationInfos::query()->get();
        return DataListResource::collection($models);
    }
    public function mediatorList(){
        $models = MediatorInfo::query()->get();
        return MediatorListResource::collection($models);
    }
    public function permissionList(){
        $models = Permission::query()->get();
        return PermissionListResource::collection($models);
    }
    public function getLaws($type){
        $models = Laws::query()->select(['name','content'])->where('type',$type)->get();
        return LawsResource::collection($models);
    }

}
